package com.ghp.common.model.dto.user;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

import static com.ghp.common.constants.ErrorMessageConstants.ACCOUNT_NOT_BLANK;
import static com.ghp.common.constants.ErrorMessageConstants.PASSWORD_NOT_BLANK;
import static com.ghp.common.constants.RegexConstants.*;

/**
 * 用户注册请求体
 */
@ApiModel(description = "用户注册信息")
@Data
public class UserRegisterDTO implements Serializable {

    private static final long serialVersionUID = 3191241716373120793L;
    /**
     * 用户账号
     */
    @ApiModelProperty(value = "用户账号", example = "admin", required = true)
    @NotBlank(message = ACCOUNT_NOT_BLANK)
    private String userAccount;

    /**
     * 用户密码
     */
    @ApiModelProperty(value = "用户密码", example = "123456", required = true)
    @NotBlank(message = PASSWORD_NOT_BLANK)
    private String userPassword;

    /**
     * 用户二次密码
     */
    @ApiModelProperty(value = "用户校验密码", example = "123456", required = true)
    @NotBlank(message = PASSWORD_NOT_BLANK)
    private String checkPassword;

    /**
     * 手机号或邮箱
     */
    @ApiModelProperty(value = "手机号或邮箱", example = "phone: 15581557895 or email: 3254213612@qq.com", required = true)
    @NotBlank(message = PASSWORD_NOT_BLANK)
    @Pattern(regexp = PHONE_REGEX + "|" + EMAIL_REGEX, message = "手机号或邮箱错误")
    private String phoneOrEmail;
    /**
     * 验证码
     */
    @ApiModelProperty(value = "验证码", required = true)
    @NotBlank(message = PASSWORD_NOT_BLANK)
    private String captcha;

}
